
use "$pathdata/Upload/Final_data_groups.dta", clear



* Figure 2(a) Prosociality
binscatter  prosociality markets_index, absorb(continent) controls(motifs_total motifs_total_sqr) ///
			graphregion(color(white)) ///
			nquant(15) ///
			ylabel(-.4(.2).4) ///
			xtitle("Importance of markets", size(large)) ytitle("Prosociality", size(large)) yscale(range(-0.5 0.4)) ///
			text( -0.3 0.5 "Slope: 0.29" "T-stat: 5.53" "P-value < 0.001" "95% CI: [0.19,0.39]", place(se) box just(left)  margin(l+2 t+1 b+1) width(23) size(2.5) linegap(0.5) bcolor(white) lcolor(black)) reportreg
graph export "$pathout/Figures/rel_prosocial.pdf", replace
		
pcorr prosociality markets_index motifs_total motifs_total_sqr dum_continent*
* pcorr = 0.1775, p-value = 0.0000
* coef = 0.29, t = 5.53, p-value = 0.000, 95%CI = 0.19,0.39



* Figure 2(b) Trust
binscatter  trust markets_index, absorb(continent) controls(motifs_total motifs_total_sqr) ///
			graphregion(color(white)) ///
			nquant(15) ///
			xtitle("Importance of markets", size(large)) ytitle("Trust", size(large)) yscale(range(-0.5 0.4)) ///
			text( -0.3 0.5 "Slope: 0.41" "T-stat: 7.99" "P-value < 0.001" "95% CI: [0.31,0.51]", place(se) box just(left)  margin(l+2 t+1 b+1) width(23) size(2.5) linegap(0.5) bcolor(white) lcolor(black)) reportreg
graph export "$pathout/Figures/trust.pdf", replace

pcorr trust markets_index motifs_total motifs_total_sqr dum_continent*
* pcorr = 0.2519, p-value = 0.0000
* slope = 0.41, t = 7.99, p = 0.000, 95%CI = 0.31,0.51



* Figure 2(c) Moral universalism values
binscatter  rel_universal markets_index, absorb(continent) controls(motifs_total motifs_total_sqr) ///
			graphregion(color(white)) ///
			nquant(15) ///
			ylabel(-.4(.2).4) ///
			xtitle("Importance of markets", size(large)) ytitle("Moral universalism", size(large)) yscale(range(-0.5 0.4)) ///
			text( -0.3 0.5 "Slope: 0.40" "T-stat: 6.97" "P-value < 0.001" "95% CI: [0.29,0.52]", place(se) box just(left)  margin(l+2 t+1 b+1) width(23) size(2.5) linegap(0.5) bcolor(white) lcolor(black)) reportreg
graph export "$pathout/Figures/rel_universal.pdf", replace
	
pcorr rel_universal markets_index motifs_total motifs_total_sqr dum_continent*
* pcorr = 0.2217, p-value = 0.0000
* slope = 0.40, t = 6.97, p = 0.000, 95%CI = 0.29,0.52



* Figure 2(d) Moral emotions
binscatter  emotions markets_index, absorb(continent) controls(motifs_total motifs_total_sqr) ///
			graphregion(color(white)) ///
			nquant(15) ///
			xtitle("Importance of markets", size(large)) ytitle("Moral emotions", size(large)) yscale(range(-0.5 0.4)) ///
			text( -0.3 0.5 "Slope: 0.44" "T-stat: 12.52" "P-value < 0.001" "95% CI: [0.37,0.50]", place(se) box just(left)  margin(l+2 t+1 b+1) width(23) size(2.5) linegap(0.5) bcolor(white) lcolor(black)) reportreg
graph export "$pathout/Figures/emotions.pdf", replace

pcorr emotions markets_index motifs_total motifs_total_sqr dum_continent*
* pcorr = 0.3780, p-value = 0.0000
* slope = 0.44, t = 12.52, p = 0.000, 95%CI = 0.37,0.50



* Figure 4(a) Historical trade routes
binscatter  markets_index proximity_trade_route, absorb(continent) controls(motifs_total motifs_total_sqr) ///
			graphregion(color(white)) ///
			nquant(15) ///
			ylabel(-.4(.2).2) ///
			ytitle("Importance of markets", size(large)) xtitle("Proximity to trade routes", size(large)) yscale(range(-0.45 0.3)) xscale(r(-1.5 2)) ///
			text( -0.2 0.9 "Slope: 0.29" "T-stat: 9.73" "P-value < 0.001" "95% CI: [0.23,0.34]", place(se) box just(left)  margin(l+2 t+1 b+1) width(23) size(2.5) linegap(0.5) bcolor(white) lcolor(black)) reportreg
graph export "$pathout/Figures/trade.pdf", replace

pcorr proximity_trade_route markets_index motifs_total motifs_total_sqr dum_continent*
* pcorr = 0.3023, p-value = 0.0000
* slope = 0.29, t = 9.73, p = 0.000, 95%CI = 0.23,0.34



* Figure 4(a) Historical trade routes
binscatter  markets_index std_eco_polarization, absorb(continent) controls(motifs_total motifs_total_sqr) ///
			graphregion(color(white)) ///
			nquant(15) ///
			ytitle("Importance of markets", size(large)) xtitle("Ecological polarization", size(large)) yscale(range(-0.35 0.3)) xscale(r(-1.6 2)) ///
			text( -0.15 0.8 "Slope: 0.11" "T-stat: 6.52" "P-value < 0.001" "95% CI: [0.07,0.14]", place(se) box just(left)  margin(l+2 t+1 b+1) width(23) size(2.5) linegap(0.5) bcolor(white) lcolor(black)) reportreg
graph export "$pathout/Figures/eco.pdf", replace

pcorr std_eco_polarization markets_index motifs_total motifs_total_sqr dum_continent*
* pcorr = 0.2083, p-value = 0.0000
* slope = 0.11, t = 6.52, p = 0.000, 95%CI = 0.07,0.14


